package com.ddd.application.impl;

import com.ddd.application.service.ProductService;
import com.ddd.domain.model.product.ProductEntity;
import com.ddd.domain.model.product.ProductRepository;
import com.ddd.domain.share.TrackingId;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 *
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    private ProductRepository productRepository;

    @Override
    public boolean addProduct() {
        ProductEntity productEntity = new ProductEntity();
        productRepository.save(productEntity);
        return true;
    }

    @Override
    public boolean productsOnTheShelves(TrackingId skuId) {
        ProductEntity product = productRepository.find(skuId);
        return productRepository.update(product);
    }
}
